package net.y2t72.microblog.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.codehaus.jackson.map.ObjectMapper;

import net.y2t72.microblog.biz.DistrictBiz;
import net.y2t72.microblog.biz.impl.DistrictBizImpl;

public class Test extends HttpServlet {

	/**
	 * 版本号
	 */
	private static final long serialVersionUID = 690626654388172223L;

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		PrintWriter out = response.getWriter();
		
		//创建DistrictBiz
		DistrictBiz districtBiz = new DistrictBizImpl();
		
		//获取省份
		List<String> list = districtBiz.getList(1);
		
		//创建绑定类
		ObjectMapper mapper = new ObjectMapper();
		
		//输出
		mapper.writeValue(out, list);
		
		//关闭流
		out.flush();
		out.close();
	}

	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request, response);
	}
	
}
